package com.mobilesalon.calendar;

import java.util.Calendar;
import java.util.List;

import com.mobilesalon.tools.DateTools;

public class CalendarEventBean {

	private final PhoneCalendarBean phoneCalendar;
	private final long eventId;
	private final String title;
	private final Calendar begin;
	private final Calendar end;
	private final Boolean allDay;
	private final String description;

	private final List<Attendee> attendees;

	public CalendarEventBean(PhoneCalendarBean phoneCalendar, long eventId, String title,
			Calendar begin, Calendar end, Boolean allDay, String description,
			List<Attendee> attendees) {
		super();
		this.phoneCalendar = phoneCalendar;
		this.eventId = eventId;
		this.title = title;
		this.begin = begin;
		this.end = end;
		this.allDay = allDay;
		this.description = description;
		this.attendees = attendees;
	}

	public PhoneCalendarBean getPhoneCalendar() {
		return phoneCalendar;
	}

	public long getEventId() {
		return eventId;
	}

	public String getTitle() {
		return title;
	}

	public Calendar getBegin() {
		return begin;
	}

	public Calendar getEnd() {
		return end;
	}

	public Boolean getAllDay() {
		return allDay;
	}

	public String getDescription() {
		return description;
	}

	public List<Attendee> getAttendees() {
		return attendees;
	}

	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		builder.append("CalendarEventBean [calendar_id=").append(phoneCalendar.getId())
				.append(phoneCalendar.getAccountOwner()).append(", eventId=").append(eventId)
				.append(", title=").append(title).append(", begin=").append(formatCalendar(begin))
				.append(", end=").append(formatCalendar(end)).append(", allDay=").append(allDay)
				.append(", description=").append(description).append(", attendee=").append("]");
		return builder.toString();
	}

	private String formatCalendar(Calendar calendar) {
		return calendar == null ? "" : DateTools.TIMESTAMP_DATEFORMAT.format(calendar.getTime());
	}

}
